package com.sgb.kjwl.view.ui.fragment.transport;

import android.os.Bundle;
import android.view.View;

import androidx.fragment.app.Fragment;

import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.AppFragNormalMyOfferBinding;
import com.swgk.core.common.base.BaseFragment;
import com.swgk.core.common.base.BaseViewModel;
import com.swgk.core.recyclerview.adapter.SlidingFragmentPagerAdapter;

import java.util.ArrayList;

/**
 * @author: 杨畔
 * @date: 2021/9/22 11:58
 * @Description: 普通货源-我的报价
 */
public class NormalMyOfferFragment extends BaseFragment<BaseViewModel, AppFragNormalMyOfferBinding> {

    private final String[] mTabs = new String[]{"全部", "已报价", "待支付", "已支付", "已失效"};
    private SlidingFragmentPagerAdapter mAdapter;

    @Override
    protected int layoutId() {
        return R.layout.app_frag_normal_my_offer;
    }

    @Override
    protected void createViewModel() {

    }

    public static NormalMyOfferFragment newInstance() {
        Bundle args = new Bundle();
        NormalMyOfferFragment fragment = new NormalMyOfferFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void init() {
        initFragment();
        mBinding.tabLayout.setNormalColor96();
    }

    private void initFragment() {
        //viewPager适配器
        ArrayList<Fragment> fragments = new ArrayList<>();
        //添加页面
        for (int i = 0; i < mTabs.length; i++) {
            fragments.add(NormalMyOfferPageFragment.newInstance(i));
        }
        mAdapter = new SlidingFragmentPagerAdapter(getChildFragmentManager(), fragments, mTabs);
        mBinding.vpMyOffer.setAdapter(mAdapter);
        mBinding.vpMyOffer.setOffscreenPageLimit(4);
        mBinding.tabLayout.setupWithViewPager(mBinding.vpMyOffer);
    }

    @Override
    public void onClick(View v) {

    }
}
